function [ v, rinter ] = scatterRayPlaneIntersect( x, r, n, i, plr0, pln ) % scatter (var) of rays intersections with a plane with norm pln and origin plr  plr = plr0 + x * pln;  % the tested plane position  cnt = size( n, 1 );  d = dot( repmat( pln, cnt, 1 ), repmat( plr, cnt, 1 ) - r, 2 ) ./ ...      dot( n, repmat( pln, cnt, 1 ), 2 );  % calculate intersection vectors  rinter = r + repmat( d, 1, 3 ) .* n; % intersection vectors  v = sum( i .* sqrt( sum( ( rinter - repmat( mean( rinter ), cnt, 1 ) ).^2, 2 ) ) ); % / ( 1 + x^2 ); % angular size of the bundle intersection with the plane  % v = sum( i .* sum( ( rinter - repmat( mean( rinter ), cnt, 1 ) ).^2, 2 ) ); % / ( 1 + x^2 ); % angular size of the bundle intersection with the planeend